package com.gnerv.author.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.gnerv.author.entity.ArticleStatistics;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 博客平台-文章统计表 服务类
 * </p>
 *
 * @author Gnerv LiGen
 * @since 2019-08-07
 */
public interface IArticleStatisticsService extends IService<ArticleStatistics> {
    boolean createBlogArticleStatistics(ArticleStatistics articleStatistics);

    boolean deleteBlogArticleStatistics(String bId);

    boolean updateBlogArticleStatistics(ArticleStatistics articleStatistics);

    /**
     * 更新文章点击量
     *
     * @param i
     * @return
     */
    @Transactional(isolation = Isolation.READ_COMMITTED)
    boolean updateBlogArticleStatisticsByClick(String aId, int i);

    /**
     * 更新文章转发量
     *
     * @param i
     * @return
     */
    @Transactional(isolation = Isolation.READ_COMMITTED)
    boolean updateBlogArticleStatisticsByForward(String aId, int i);

    /**
     * 更新文章评论量
     *
     * @param i
     * @return
     */
    @Transactional(isolation = Isolation.READ_COMMITTED)
    boolean updateBlogArticleStatisticsByComment(String aId, int i);

    ArticleStatistics selectBlogArticleStatistics(String bId);

    List<ArticleStatistics> listBlogArticleStatistics(ArticleStatistics articleStatistics);
}
